<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ include file="../common/header.jsp"%>

<div class="am-g am-g-fixed">
	<div class="am-u-sm-12 am-u-md-12">
		<div class="theme-popover">
			<div class="searchAbout">
				<span class="font-pale">${navTip}</span> 
				<span>&nbsp;&nbsp;&nbsp;</span>
				<span>共<span style="color:#8c222c;">${pages.getTotal()}</span>条结果</span>
			</div>
			<ul class="select">
				<p class="title font-normal">
					<span class="fl">筛选:</span>
				</p>
				<div class="clear"></div>

				<form id="myform" class="am-form am-form-horizontal"
					action="${pageContext.request.contextPath}/home/book/list.action"
					method="POST">


					<input type="hidden" id="pageIndex" name="pageIndex" value="1" />
					<input type="hidden" id="errorMsg" value="${msg}" />

					<div class="am-form-group form-style">
						<label for="bookName" class="am-form-label">书名</label>
						<div class="am-form-content">
							<input type="text" name="bookName" value="${bookName}" />

						</div>
					</div>

					<div class="am-form-group form-style">
						<label for="author" class="am-form-label">作者</label>
						<div class="am-form-content">
							<input id="author" name="author" type="text" value="${author}" />

						</div>
					</div>

					<div class="am-form-group form-style">
						<label for="condition" class="am-form-label">品相</label>
						<div class="am-form-content condition">
							
							<select name="condition">
										<c:if
											test="${conditionList != null && fn:length(conditionList) != 0}">
											<option value="">--请选择--</option>
											<c:forEach var="dict_status" items="${conditionList}">
												<option
													<c:if test="${dict_status.valueId == condition}">
														selected="selected"</c:if> 
													value="${dict_status.valueId}">${dict_status.valueName}</option>
											</c:forEach>
										</c:if>
							</select>
						</div>
					</div>
					<div class="am-form-group form-style">
						<label for="condition" class="am-form-label">价格范围</label>
						<div class="am-form-content">

							<select name="rangeIndex">
								<c:if test="${priceRangeList != null && fn:length(priceRangeList) != 0}">
											<option value="-1">--请选择--</option>
											<c:forEach var="dict_status" items="${priceRangeList}">
												<option
													<c:if test="${dict_status.valueId == rangeIndex}">
														selected="selected"</c:if> 
													value="${dict_status.valueId}">${dict_status.valueName}</option>
											</c:forEach>
										</c:if>
							</select>


						</div>
					</div>

					<div class="info-btn">
						<button type="submit" class="am-btn am-btn-danger">筛选</button>
					</div>

				</form>



			</ul>
			<div class="clear"></div>
		</div>



		<!-- content srart -->
		<div class="search-content">
			<div class="am-g am-g-fixed blog-fixed">
				<div class="am-u-md-12 am-u-sm-12">
					<c:choose>
				
					<c:when test="${bookList != null && fn:length(bookList) != 0}">
					<c:forEach var="book" items="${bookList}">
						<article class="am-g blog-entry-article">

							<div class="am-u-lg-2 am-u-md-2 am-u-sm-2 blog-entry-img">
								<a class="bookinfo" 
									url="${pageContext.request.contextPath}/"
									bid="${book.id}"><img src="${book.imgPic}" alt="" class="am-u-sm-6"></a>
							</div>

							<div class="am-u-lg-10 am-u-md-10 blog-entry-text">
								<div class="item-info">
									<a 
										class="bookinfo book-name" 
										url="${pageContext.request.contextPath}/"
										bid="${book.id}"><b>${book.bookName}</b></a>
									<div class="item-normal-info item-span">
										<span>作者: &nbsp;${book.author}</span>
										<div class="clear"></div>
										<span>出版社: &nbsp;${book.publish}</span>
										<div class="clear"></div>
										<span>ISBN: &nbsp;${book.isbn}</span>
									</div>
								</div>


								<div class="item-other-info item-span">
									<span style="font-weight: bolder;">${book.condition}成新</span> <span
										class="book-price"><b>交易价: &nbsp;¥</b> <strong>${book.sellPrice}</strong></span>
									<span class="book-price-fix">定价: &nbsp;¥
										${book.fixPrice}</span> <span>上架时间: &nbsp;<fmt:formatDate
											value="${book.onSaleDate}" pattern="yyyy-MM-dd" /></span>

								</div>
							</div>

							<!-- 移动端单独适应 -->
							<div class="am-u-sm-10 sm-article">
								<div class="item-info item-span">
									<a 
									class="bookinfo book-name" 
									url="${pageContext.request.contextPath}/"
									bid="${book.id}"><b>${book.bookName}</b></a> <span
										style="font-weight: bolder;">${book.condition}成新</span> <span
										class="book-price"><b>交易价: &nbsp;¥</b> <strong>${book.sellPrice}</strong></span>
									<span class="book-price-fix">定价: &nbsp;¥
										${book.fixPrice}</span>
								</div>

							</div>

						</article>
					</c:forEach>
					</c:when>
					
					<c:otherwise>
					
						<div class="result-none">
							<div class="text">没有找到符合条件的结果</div>
							<div class="text">
								<a href="javascript:history.go(-1);">返&nbsp;回</a>
							</div>
						</div>
					
					</c:otherwise>
					</c:choose>
				</div>

			</div>
		</div>
		<!-- content end -->


		<div class="clear"></div>

		<!--分页 -->
		<ul class="am-pagination am-pagination-right">
			<c:if test="${pages.getPageNum() >1 && pages.getPages() > 1}">
				<li><a class="am-active"
					href="javascript:page_nav(document.forms[1];">首页</a></li>
				<li><a
					href="javascript:page_nav(document.forms[1],${pages.getPageNum()-1});">上一页</a>
				</li>
			</c:if>
			<c:if test="${pages.getPageNum() < pages.getTotal() && pages.getPages() > 1}">
				<li><a
					href="javascript:page_nav(document.forms[1],${pages.getPageNum()+1});">下一页</a>
				</li>
				<li><a
					href="javascript:page_nav(document.forms[1],${pages.getTotal()});">末页</a>
				</li>
			</c:if>
		</ul>

	</div>
</div>




<%@ include file="../common/footer.jsp"%>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/statics/myjs/bookList.js"></script>
	<script src="${pageContext.request.contextPath}/statics/myjs/common.js"></script>